Nixでkittyを入れたらFailed to create GLFWwindowというエラーが出た
#備忘録 #解決済み
解決方法
NixGLをインストールする。
Flakeでのインストールはここに書いてある。
自分の場合はhome-managerを使っているので、overlayしてkittyを起動する箇所全ての呼び出しをnixGLIntel kittyにした。
参考までに自分のflake.nixを貼っておく。
flake.nix
code:flake.nix
inputs = {
nixgl.url = "github:nix-community/nixGL";
};
outputs = { nixpkgs, nixgl, ...}@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
overlays = [
nixgl.overlay
];
in {
// 他の設定
};
home.nix
code:home.nix
{ config, pkgs, overlays, inputs, ... }:
home.packages = with pkgs; [
# flake.nixでoverlayを設定したのでnixpkgs.nixgl.*が使えるようになっている
nixgl.nixGLIntel
];
環境
nix (Nix) 2.24.4
home-manager 24.11-pre
問題の概要
問題となる挙動
KittyなどのターミナルをNixで導入しようとしたら一様にエラーを吐いて起動できなくなった。
類似の問題と思われるissue
Alacritty won't start - found no glX extensions · Issue #80702 · NixOS/nixpkgs · GitHub
bug: openGL terminals not running on Pop!_OS · Issue #2251 · nix-community/home-manager · GitHub
エラーログ
kittyの場合
code:txt
❯ /nix/store/qy732k1z45khip85wrdqdi26rxrlxakq-kitty-0.36.1/bin/kitty
0.046 Ignoring invalid config line: 'url_excluded_characters'
0.046 Ignoring unknown config key: resize_draw_strategy
0.050 Failed to set locale with LANG: en_US.UTF-8
0.050 Failed to set locale with no LANG
0.073 glfw error 65542: EGL: Failed to get EGL display: Success
0.079 Traceback (most recent call last):
File "/nix/store/qy732k1z45khip85wrdqdi26rxrlxakq-kitty-0.36.1/bin/../lib/kitty/kitty/main.py", line 531, in main
_main()
File "/nix/store/qy732k1z45khip85wrdqdi26rxrlxakq-kitty-0.36.1/bin/../lib/kitty/kitty/main.py", line 523, in _main
run_app(opts, cli_opts, bad_lines, talk_fd)
File "/nix/store/qy732k1z45khip85wrdqdi26rxrlxakq-kitty-0.36.1/bin/../lib/kitty/kitty/main.py", line 253, in __call__
_run_app(opts, args, bad_lines, talk_fd)
File "/nix/store/qy732k1z45khip85wrdqdi26rxrlxakq-kitty-0.36.1/bin/../lib/kitty/kitty/main.py", line 222, in _run_app
window_id = create_os_window(
^^^^^^^^^^^^^^^^^
ValueError: Failed to create GLFWwindow
Alacrittyの場合
code:txt
❯ nix run nixpkgs#alacritty
Error: Error { raw_code: None, raw_os_message: None, kind: NotSupported("provided display handle is not supported") }
考えれられる原因
kittyなどのターミナルエミュレータはOpenGL等のライブラリを使う。
恐らくそれらのライブラリの読み込みに失敗して起動できなくなったと思われる。